<?php
namespace Admin\Controller;
use Admin\Model\IndexModel;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        if (IS_GET) {
            $this->display();
            return;
        }
        $Login = new IndexModel();
        $data = $Login->Login();
        $accessUrls = $Login->getAccessUrls($data['role_id']);


        if(empty($data)){
            $this->ajaxReturn(array('status'=>false,'error'=>$Login->getError()));
            return;
        }
        session('accessUrls',$accessUrls);//动态验证
        session('role_id',$data['role_id']);
        $this->ajaxReturn(array('status'=>true,'role_id'=>$data['role_id']));
    }
}